<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../node_modules/vue/dist/vue.js"></script>
    <script src="../velocity.min.js"></script>
</head>
<body>
    <div id="root">
        <!-- 
            接受函数里有两个参数一个是el代表内容
            只有enter还有leave里有另一个参数done,
            表示动画结束,done调用使用函数方式即done()
        -->
        <transition 
        name = 'fade'
        @before-enter="beforeEnter"
        @enter
        >
        <div v-if="show">hello world</div>
        </transition>
        
        <button @click="handleClick">切换</button>
    </div>

    <script>
        var vm  = new Vue({
            el:'#root',
            data:{
                show:true
            },
            methods:{
                handleClick(){
                    this.show = !this.show
                },
                beforeEnter(el){
                    el.style.color='red'
                }
            }
        })
    </script>
</body>
</html>